
@extends('common.header')

<!-- 1.添加meta csrf_token -->
<meta name="csrf-token" content="{{ csrf_token() }}">  
<script src=" {{ asset('/js/jquery-1.8.3.min.js') }} "></script>
<script type="text/javascript">
	
	<!-- 2.设置全局ajax选项 -->
	$.ajaxSetup({
		headers: {
			'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
		}
	});
	// 获取 token
	var _token = $('meta[name="csrf-token"]').attr('content');
	
	
		
</script>
<body>

<br/>
<br/>
<br/>
<br/>
<br/>


<div class="col-xs-12 col-sm-6 col-md-1">
</div>	
<!-- 页面标记  -->

<!-- 点击添加的弹出框 开始-->
<div style="width:1000px;position:fixed;top:52px;left:50%;margin-left:-500px;z-index:1000;height:40px;background:#c9302c;display:none;color:#fff;line-height:40px;font-size:18px;text-align:center" class="opa"></div>
<!-- 点击添加的弹出框 结束-->
<h1 style="margin:30px;color:green;">添加前台用户</h1>

<div class="col-xs-12 col-sm-6 col-md-10 col-md-offset-1" >
	
	<!-- 账户 -->
	<div  class="form-group">
		<label class="col-sm-2 control-label">账号</label>
		<div class="col-sm-10">
			<input style="width:430px;" type="text" name="name" value="" class="form-control username"  placeholder="账户">
		</div>
	</div>
	
	
	<br/><br/>
	<!-- 电话 -->
	<div  class="form-group">
	  <label class="col-sm-2 control-label">电话</label>
	  <div class="col-sm-10">
		<input style="width:430px;" type="text" name="phone" value="" class="form-control phone"  placeholder="电话">
	  </div>
	</div>
	
	
	<br/><br/>
	<!-- 密码 -->
	<div  class="form-group">
	  <label class="col-sm-2 control-label">密码</label>
	  <div class="col-sm-10">
		<input style="width:430px;" type="password" name="pass" value="" class="form-control pass"  placeholder="密码">
	  </div>
	</div>
	
	
	
	<br/><br/>
	<!-- 确认密码 -->
	<div  class="form-group">
		<label class="col-sm-2 control-label">确认密码</label>
		<div class="col-sm-10">
			<input style="width:430px;" type="password" name="repass" value="" class="form-control repass"  placeholder="密码">
		</div>
	</div>
	
	
	
	
	<br/><br/>
	
	<button  style="width:300px;margin-top:2%;margin-left:200px;"  class="btn btn-danger">添加</button>

	<div style=" margin-top:20px; margin-left:200px;">
		<a href ="javascript:history.back();" style="width:300px;" class="btn btn-success">
			返回
		</a>
	</div>
	
	
	<br/><br/>
	<br/><br/><br/>
	
</div>

<script type="text/javascript">
//点击添加
$(".btn-danger").click(function(){
	var name=$(".username").val();
	var pass = $(".pass").val();
    var repass = $(".repass").val();
	var phone = $(".phone").val();
	$.ajax({
		 type: "post",
         url:"{{ url('/usercreate') }}",
         data: {
            name: name,
            phone: phone,
            pass: pass,
            repass: repass,
            _token: _token
        },
         async: false,
         dataType: "json",
		 success: function (back) {
			if( back['show_info']=='注册成功' )
			{
				$(".btn-danger").attr('disabled',true);
			}
			$(".opa").html(back['show_info']);
			$(".opa").slideDown(1000);
			$(".opa").delay(1500).slideUp(1000);
		 }
	})
})

</script>

</body>
@extends('common.footer')